class wheaterMonth {
  constructor(month, dataStore) {
    this.month = month;
    this.dataStore = dataStore;
  }
  // 添加一条记录
  add(date, record) {
    this.dataStore[date] = record;
  }
  // 平局气温  type:1 === 周 2 === 月
  averageTemperature(type, whichWeek) {
    let average = 0
    switch (type) {
      case 1:
        break;
      case 2:
        const records = Object.getOwnPropertyNames(this.dataStore).length
        let sum = 0
        for (var key in this.dataStore) {
          sum+= this.dataStore[key]
        }
        average = sum/records
    }
    return average
  }
}
const wheaters = {
  "2021-05-01": 24,
  "2021-05-02": 21,
  "2021-05-03": 24.6,
  "2021-05-04": 22,
  "2021-05-05": 19,
  "2021-05-06": 23,
  "2021-05-07": 32,
  "2021-05-08": 33,
  "2021-05-09": 30,
  "2021-05-10": 29,
  "2021-05-11": 22,
  "2021-05-12": 25,
  "2021-05-13": 11,
  "2021-05-15": 17,
  "2021-05-16": 18,
  "2021-05-17": 19,
  "2021-05-18": 22,
  "2021-05-19": 20,
  "2021-05-20": 18,
  "2021-05-21": 19,
  "2021-05-22": 24,
  "2021-05-23": 21,
  "2021-05-25": 20,
  "2021-05-26": 21,
  "2021-05-27": 23,
  "2021-05-28": 26,
  "2021-05-29": 25,
};
const fiveMnth = new wheaterMonth(5,wheaters)
const monthAverage = fiveMnth.averageTemperature(2)
console.log(monthAverage)
